package de.freudenreichdesign.webshop.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Entity
@Table (name="SELLER")
public class Seller implements Serializable{

	private static final long serialVersionUID = 5806621003044384864L;
	private long sellerID;
	private Person contactPerson;
	private String nameOfCompany;
	private int fax;
	private int salesTaxID;
	
	@SuppressWarnings("unused")
	private Seller() {}
	
	public Seller(Person person, int fax, int salesTaxID) {
		this.contactPerson = person;
		this.fax = fax;
		this.salesTaxID = salesTaxID;
	}

	public void setSellerID(long sellerID) {
		this.sellerID = sellerID;
	}

	@Id
	@GeneratedValue (strategy=GenerationType.AUTO)
	@Column (name="SELLER_ID")
	public long getSellerID() {
		return sellerID;
	}

	@Column (name="NAME_OF_COMPANY")
	public String getNameOfCompany() {
		return nameOfCompany;
	}

	public void setNameOfCompany(String nameOfCompany) {
		this.nameOfCompany = nameOfCompany;
	}

	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	@PrimaryKeyJoinColumn (name="CONTACT_PERSON")
	public Person getContactPerson() {
		return contactPerson;
	}

	public void setContactPerson(Person person) {
		this.contactPerson = person;
	}

	@Column (name="FAX")
	public int getFax() {
		return fax;
	}
	
	public void setFax(int fax) {
		this.fax = fax;
	}
	
	@Column (name="SALES_TAX_ID")
	public int getSalesTaxID() {
		return salesTaxID;
	}
	
	public void setSalesTaxID(int salesTaxID) {
		this.salesTaxID = salesTaxID;
	}

}
